import requests
from bs4 import BeautifulSoup
def get_douban_top250():
    url="https://movie.douban.com/top250"
    headers={
        "user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0"
    }
    response=requests.get(url,headers=headers)
    soup=BeautifulSoup(response.text,'html.parser')

    movies=soup.find_all('div',class_='item')
    for movie in movies:
        title=movie.find('span',class_='title').text
        rating=movie.find('span',class_='rating_num').text
        quote=movie.find('p',class_='quote').text.strip()
        print(f"电影名:{title} ,评分:{rating}\n简介:{quote}\n")

get_douban_top250()